/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.buanalintas.sandals.pos.entities;

import com.buanalintas.bynga.entities.MasterUnit;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dedy
 */
@Entity
@Table(name = "pos_transaction_finance")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PosTransactionFinance.findAll", query = "SELECT p FROM PosTransactionFinance p"),
    @NamedQuery(name = "PosTransactionFinance.findBySync", query = "SELECT p FROM PosTransactionFinance p WHERE p.sync = :sync"),
    @NamedQuery(name = "PosTransactionFinance.findByFinanceId", query = "SELECT p FROM PosTransactionFinance p WHERE p.financeId = :financeId"),
    @NamedQuery(name = "PosTransactionFinance.findByFinanceFromDate", query = "SELECT p FROM PosTransactionFinance p WHERE p.financeFromDate = :financeFromDate"),
    @NamedQuery(name = "PosTransactionFinance.findByFinanceToDate", query = "SELECT p FROM PosTransactionFinance p WHERE p.financeToDate = :financeToDate"),
    @NamedQuery(name = "PosTransactionFinance.findByFinanceTotalSale", query = "SELECT p FROM PosTransactionFinance p WHERE p.financeTotalSale = :financeTotalSale"),
    @NamedQuery(name = "PosTransactionFinance.findByFinanceExpense", query = "SELECT p FROM PosTransactionFinance p WHERE p.financeExpense = :financeExpense"),
    @NamedQuery(name = "PosTransactionFinance.findByFinanceNetSale", query = "SELECT p FROM PosTransactionFinance p WHERE p.financeNetSale = :financeNetSale"),
    @NamedQuery(name = "PosTransactionFinance.findByFinanceGrossProfit", query = "SELECT p FROM PosTransactionFinance p WHERE p.financeGrossProfit = :financeGrossProfit"),
    @NamedQuery(name = "PosTransactionFinance.findByFinanceCost", query = "SELECT p FROM PosTransactionFinance p WHERE p.financeCost = :financeCost"),
    @NamedQuery(name = "PosTransactionFinance.findByFinanceNett", query = "SELECT p FROM PosTransactionFinance p WHERE p.financeNett = :financeNett"),
    @NamedQuery(name = "PosTransactionFinance.findByFinanceTimestamp", query = "SELECT p FROM PosTransactionFinance p WHERE p.financeTimestamp = :financeTimestamp")})
public class PosTransactionFinance implements Serializable {
    private static final long serialVersionUID = 1L;
    @Column(name = "sync")
    private String sync;
    @Id
    @Basic(optional = false)
    @Column(name = "finance_id")
    private Integer financeId;
    @Column(name = "finance_from_date")
    @Temporal(TemporalType.DATE)
    private Date financeFromDate;
    @Column(name = "finance_to_date")
    @Temporal(TemporalType.DATE)
    private Date financeToDate;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "finance_total_sale")
    private BigDecimal financeTotalSale;
    @Column(name = "finance_expense")
    private BigDecimal financeExpense;
    @Column(name = "finance_net_sale")
    private BigDecimal financeNetSale;
    @Column(name = "finance_gross_profit")
    private BigDecimal financeGrossProfit;
    @Column(name = "finance_cost")
    private BigDecimal financeCost;
    @Column(name = "finance_nett")
    private BigDecimal financeNett;
    @Column(name = "finance_timestamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date financeTimestamp;
   @JoinColumn(name = "finance_unit_id", referencedColumnName = "unit_id")
    @ManyToOne(optional = false)
    private MasterUnit financeUnitId;
    public PosTransactionFinance() {
    }

    public MasterUnit getFinanceUnitId() {
        return financeUnitId;
    }

    public void setFinanceUnitId(MasterUnit financeUnitId) {
        this.financeUnitId = financeUnitId;
    }

    public PosTransactionFinance(Integer financeId) {
        this.financeId = financeId;
    }

    public String getSync() {
        return sync;
    }

    public void setSync(String sync) {
        this.sync = sync;
    }

    public Integer getFinanceId() {
        return financeId;
    }

    public void setFinanceId(Integer financeId) {
        this.financeId = financeId;
    }

    public Date getFinanceFromDate() {
        return financeFromDate;
    }

    public void setFinanceFromDate(Date financeFromDate) {
        this.financeFromDate = financeFromDate;
    }

    public Date getFinanceToDate() {
        return financeToDate;
    }

    public void setFinanceToDate(Date financeToDate) {
        this.financeToDate = financeToDate;
    }

    public BigDecimal getFinanceTotalSale() {
        return financeTotalSale;
    }

    public void setFinanceTotalSale(BigDecimal financeTotalSale) {
        this.financeTotalSale = financeTotalSale;
    }

    public BigDecimal getFinanceExpense() {
        return financeExpense;
    }

    public void setFinanceExpense(BigDecimal financeExpense) {
        this.financeExpense = financeExpense;
    }

    public BigDecimal getFinanceNetSale() {
        return financeNetSale;
    }

    public void setFinanceNetSale(BigDecimal financeNetSale) {
        this.financeNetSale = financeNetSale;
    }

    public BigDecimal getFinanceGrossProfit() {
        return financeGrossProfit;
    }

    public void setFinanceGrossProfit(BigDecimal financeGrossProfit) {
        this.financeGrossProfit = financeGrossProfit;
    }

    public BigDecimal getFinanceCost() {
        return financeCost;
    }

    public void setFinanceCost(BigDecimal financeCost) {
        this.financeCost = financeCost;
    }

    public BigDecimal getFinanceNett() {
        return financeNett;
    }

    public void setFinanceNett(BigDecimal financeNett) {
        this.financeNett = financeNett;
    }

    public Date getFinanceTimestamp() {
        return financeTimestamp;
    }

    public void setFinanceTimestamp(Date financeTimestamp) {
        this.financeTimestamp = financeTimestamp;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (financeId != null ? financeId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PosTransactionFinance)) {
            return false;
        }
        PosTransactionFinance other = (PosTransactionFinance) object;
        if ((this.financeId == null && other.financeId != null) || (this.financeId != null && !this.financeId.equals(other.financeId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.buanalintas.sandals.pos.entities.PosTransactionFinance[ financeId=" + financeId + " ]";
    }
    
}
